<script setup>
import { ref, mixin } from 'vue'
import { showStatus } from '../projectMethods'
import {
  submitRecordCheck,
  saveFile
} from '@/api/projectRecord'
const props = defineProps({
  detailData: {
    type: Object,
    default: {}
  },
  pkid: {
    type: String
  },
  status: {
    type: String
  },
  currentTab: {
    type: String
  },
  defaultIndex: {
    type: String
  }
})
console.log(props)
// const params = ref({pkid:props.pkid,stage:props.detailData.projectClPoList[0].stage})
const saveFileContent = (data) => {
  let params = {
    pkid: props.pkid,
    stage: props.detailData.projectClPoList[0].stage
  }
  console.log(props.pkid, params)
  console.log('保存', data)
  saveFile(params)
    .then((res) => {
      console.log(res)
    })
    .catch((err) => {
      console.log(err)
    })
}
const sumbit = function () {
  console.log('提交')
  let params = {
    pkid: props.pkid,
    stage: props.detailData.projectClPoList[0].stage
  }
  submitRecordCheck(params)
    .then((res) => {
      console.log(res)
    })
    .catch((err) => {
      console.log(err)
    })
}
</script>
<template>
  <div class="bottom_box">
    <div class="box_left">
      <div class="sh">审核记录</div>
      <div class="shTime">
        审核时间：{{
          detailData.projectRecordCheckPoList[0]
            ? detailData.projectRecordCheckPoList[0]
                .checkTime
            : '无审核记录'
        }}
      </div>
      <div class="shTime">
        审核结果：<span
          style="
            color: #f9801c;
            font-size: 14px;
            font-weight: 400;
          "
          >{{
            detailData.projectRecordCheckPoList[0]
              ? detailData.projectRecordCheckPoList[0]
                  .checkStatus
              : '无审核记录'
          }}</span
        >
      </div>
      <div class="shTime">
        审核意见：<span
          class="yijian"
          style="font-size: 14px; font-weight: 400"
          >{{
            detailData.projectRecordCheckPoList[0]
              ? detailData.projectRecordCheckPoList[0]
                  .checkOpinion
              : '无审核记录'
          }}</span
        >
      </div>
    </div>
    <div
      class="box_right"
      v-if="
        status !== '1' && currentTab == Number(defaultIndex)
      "
    >
      <div
        class="sh save"
        @click="saveFileContent(detailData)"
      >
        保存
      </div>
      <div class="sh" @click="sumbit()">提交</div>
    </div>
  </div>
</template>
<style scoped lang="scss">
.bottom_box {
  width: 100%;
  height: 78px;
  box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  position: fixed;
  bottom: 0;
  z-index: 1000;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 29px 0 40px;
  overflow: hidden;
  .sh {
    width: 90px;
    height: 32px;
    background: #497fa3;
    border-radius: 2px;
    font-weight: 400;
    color: #ffffff;
    font-size: 14px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    margin-left: 20px;
  }
  .save {
    background-color: #ffffff;
    border: 1px solid #497fa3;
    color: #497fa3;
  }
  .box_left {
    width: 70%;
    display: flex;
    justify-content: flex-start;
    .shTime {
      // align-items: center;
      display: flex;
      align-items: center;
      margin-left: 20px;
      .yijian {
        display: inline-block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 500px;
      }
    }
  }
  .box_right {
    width: 30%;
    display: flex;
    // justify-content: flex-end;
  }
}
</style>
